jade.wrapper
Class AgentContainer

java.lang.Object
  |
  +--jade.wrapper.AgentContainer
Direct Known Subclasses:
MainContainer

public class AgentContainer
extends java.lang.Object

This class is a Proxy class, allowing access to a JADE agent container. Invoking methods on instances of this class, it is possible to request services from in-process agent containers. This class must not be instantiated by applications. Instead, use the createContainer() method in class Runtime.

Author:
Giovanni Rimassa - Universita` di Parma
See Also:
Runtime.createAgentContainer(Profile)

Constructor Summary
AgentContainer(jade.core.AgentContainerImpl impl)
          Public constructor.
 
Method Summary
 Agent createAgent(java.lang.String nickname, java.lang.String className, java.lang.Object[] args)
          Creates a new JADE agent, running within this container,
 Agent createAgent(java.lang.String nickname, java.lang.String className, java.lang.String[] sargs)
          Deprecated. The array of agent arguments is now Object[] and no more String[]
 void installMTP(java.lang.String address, java.lang.String className)
          Installs a new message transport protocol, that will run within this container.
 void kill()
          Shuts down this container, terminating all the agents running within it.
 void uninstallMTP(java.lang.String address)
          Removes a message transport protocol, previously running within this container.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgentContainer

public AgentContainer(jade.core.AgentContainerImpl impl)
Public constructor. This constructor requires a concrete implementation of a JADE agent container, which cannot be instantiated bt applications, so it cannot be meaningfully called from application code. The proper way to create an agent container from an application is to call the Runtime.createContainer() method.
Parameters:
impl - A concrete implementation of a JADE agent container.
See Also:
Runtime.createAgentContainer(Profile)
Method Detail

createAgent

public Agent createAgent(java.lang.String nickname,
                         java.lang.String className,
                         java.lang.String[] sargs)
                  throws NotFoundException,
                         StaleProxyException
Deprecated. The array of agent arguments is now Object[] and no more String[]

Creates a new JADE agent, running within this container,
Parameters:
nickname - A platform-unique nickname for the newly created agent. The agent will be given a FIPA compliant agent identifier using the nickname and the ID of the platform it is running on.
className - The fully qualified name of the class that implements the agent.
args - A string array, containing initialization parameters to pass to the new agent. The setArguments() method of the jade.core.Agent class will be called on the new agent with this array as argument.
Returns:
A proxy object, allowing to call state-transition forcing methods on the real agent instance.

createAgent

public Agent createAgent(java.lang.String nickname,
                         java.lang.String className,
                         java.lang.Object[] args)
                  throws NotFoundException,
                         StaleProxyException
Creates a new JADE agent, running within this container,
Parameters:
nickname - A platform-unique nickname for the newly created agent. The agent will be given a FIPA compliant agent identifier using the nickname and the ID of the platform it is running on.
className - The fully qualified name of the class that implements the agent.
args - An object array, containing initialization parameters to pass to the new agent.
Returns:
A proxy object, allowing to call state-transition forcing methods on the real agent instance.

kill

public void kill()
          throws StaleProxyException
Shuts down this container, terminating all the agents running within it.

installMTP

public void installMTP(java.lang.String address,
                       java.lang.String className)
                throws MTPException,
                       StaleProxyException
Installs a new message transport protocol, that will run within this container.
Parameters:
address - The transport address exported by the new MTP, in string format.
className - The fully qualified name of the Java class that implements the transport protocol.
Throws:
MTPException - If something goes wrong during transport protocol activation.

uninstallMTP

public void uninstallMTP(java.lang.String address)
                  throws MTPException,
                         NotFoundException,
                         StaleProxyException
Removes a message transport protocol, previously running within this container.
Parameters:
address - The transport address exported by the new MTP, in string format.
Throws:
MTPException - If something goes wrong during transport protocol activation.
NotFoundException - If no protocol with the given address is currently installed on this container.